public class Login {
    private String userName = "admin";
    private String password = "12345";
    public void loginInfo(String name,String password) throws loginNameException, loginPasswordException {
        if(!name.equals(this.userName)){
            throw new loginNameException("用户名错误");
        }
        if(!password.equals(this.password)){
            throw  new loginPasswordException("密码错误");
        }
        System.out.println("登录成功");
    }

    public static void main(String[] args) throws loginPasswordException, loginNameException {
        Login login = new Login();
        login.loginInfo("admin","12345");
    }
}
